package com.ruoyi.personnel.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.personnel.domain.ResearchMeeting;
import com.ruoyi.personnel.mapper.ResearchMeetingMapper;
import com.ruoyi.personnel.service.IResearchMeetingService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 科研会议Service业务层处理
 *
 * @author ruoyi
 * @date 2021-03-02
 */
@Service
public class ResearchMeetingServiceImpl extends ServiceImpl<ResearchMeetingMapper, ResearchMeeting> implements IResearchMeetingService {

    @Override
    public List<ResearchMeeting> queryList(ResearchMeeting researchMeeting) {
        LambdaQueryWrapper<ResearchMeeting> lqw = Wrappers.lambdaQuery();
        if (StringUtils.isNotBlank(researchMeeting.getName())){
            lqw.like(ResearchMeeting::getName ,researchMeeting.getName());
        }
        if (StringUtils.isNotBlank(researchMeeting.getJobNumber())){
            lqw.eq(ResearchMeeting::getJobNumber ,researchMeeting.getJobNumber());
        }
        if (StringUtils.isNotBlank(researchMeeting.getPersonnelId())){
            lqw.eq(ResearchMeeting::getPersonnelId ,researchMeeting.getPersonnelId());
        }
        if (StringUtils.isNotBlank(researchMeeting.getMeetingName())){
            lqw.like(ResearchMeeting::getMeetingName ,researchMeeting.getMeetingName());
        }
        if (StringUtils.isNotBlank(researchMeeting.getMeetingType())){
            lqw.eq(ResearchMeeting::getMeetingType ,researchMeeting.getMeetingType());
        }
        if (StringUtils.isNotBlank(researchMeeting.getMeetingAddress())){
            lqw.eq(ResearchMeeting::getMeetingAddress ,researchMeeting.getMeetingAddress());
        }
        if (StringUtils.isNotBlank(researchMeeting.getMeetingScale())){
            lqw.eq(ResearchMeeting::getMeetingScale ,researchMeeting.getMeetingScale());
        }
        if (StringUtils.isNotBlank(researchMeeting.getMeetingDescribe())){
            lqw.eq(ResearchMeeting::getMeetingDescribe ,researchMeeting.getMeetingDescribe());
        }
        if (StringUtils.isNotBlank(researchMeeting.getOrganizer())){
            lqw.eq(ResearchMeeting::getOrganizer ,researchMeeting.getOrganizer());
        }
        if (researchMeeting.getOfficeId() != null){
            lqw.eq(ResearchMeeting::getOfficeId ,researchMeeting.getOfficeId());
        }
        if (StringUtils.isNotBlank(researchMeeting.getOfficeName())){
            lqw.like(ResearchMeeting::getOfficeName ,researchMeeting.getOfficeName());
        }
        if (StringUtils.isNotBlank(researchMeeting.getMeetingStart())){
            lqw.eq(ResearchMeeting::getMeetingStart ,researchMeeting.getMeetingStart());
        }
        if (StringUtils.isNotBlank(researchMeeting.getMeetingEnd())){
            lqw.eq(ResearchMeeting::getMeetingEnd ,researchMeeting.getMeetingEnd());
        }
        if (StringUtils.isNotBlank(researchMeeting.getStatus())){
            lqw.eq(ResearchMeeting::getStatus ,researchMeeting.getStatus());
        }
        return this.list(lqw);
    }
}
